//
//  JCUserDefaultsUtil.swift
//  JCPublicKit
//
//  Created by JasonLee on 2020/5/15.
//

import Foundation

class JCUserDefaultsUtil: NSObject {
    @objc static func value(for key: String) -> Any? {
        return UserDefaults.standard.value(forKey: key)
    }
    @objc static func set(value: Any?, for key: String) {
        UserDefaults.standard.set(value, forKey: key)
    }
    @objc static func remove(for key: String) {
        UserDefaults.standard.removeObject(forKey: key)
    }
}

extension UserDefaults {
    subscript<T>(key: String) -> T? {
        return value(forKey: key) as? T
    }
}
